package com.szzg10.thinking.chapter18;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;

public class IoBufferDemo {

	public static void main(String[] args) {
		ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
		IntBuffer intBuffer = byteBuffer.asIntBuffer();
		
		intBuffer.put(new int[] {11, 42, 47, 99, 143, 811, 1016});
		System.out.println(intBuffer.get(3));
		
		intBuffer.put(3, 1811);
		
		intBuffer.flip();
		while(intBuffer.hasRemaining()) {
			int i = intBuffer.get();
			System.out.println(i);
		}
	}
}
